package org.example.mybatis.service;

import org.example.mybatis.domain.AiSession;
import org.example.mybatis.mapper.AiSessionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.UUID;

@Service
public class Insert {

    @Autowired
    private AiSessionMapper aiSessionMapper;

    public String insert(String que){
        AiSession aiSession = new AiSession();
        String sessionId = UUID.randomUUID().toString();
        aiSession.setQueryText(que);
        aiSession.setSessionId(sessionId);
        aiSession.setCreatedAt(LocalDateTime.now());
        aiSessionMapper.insert(aiSession);
        return sessionId;
    }

}
